package demo.standard;

import java.util.ArrayList;
import java.util.List;

public class Invoker {

    private List<ICommand> commands = new ArrayList<>();

    public void addCommand(ICommand command) {
        commands.add(command);
    }

    public void use() {
        for (ICommand command : commands) {
            command.exec();
        }
        System.out.println("命令执行完毕\n");
    }
}
